#ifndef QMLTABLEVIEW_H
#define QMLTABLEVIEW_H

#include <QObject>
#include <QAbstractTableModel>


enum Role{
    OneRole,
    TwoRole,
    ThreeRole,
    ThridRole
};

typedef struct rowData{
    int index;
    QString data;
    QString title;
    QString date;
}*pRowData;

class QmlTableView : public QAbstractTableModel
{
    Q_OBJECT
public:
    explicit QmlTableView(QObject *parent = 0);

public:
     virtual int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
     virtual int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
     virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
     virtual QVariant headerData(int section, Qt::Orientation orientation,int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;

     QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;


     void refResh();

signals:

public slots:
 void initData();
 void sltAppendData(pRowData rowData);
private:
 void clearData();
//    void initData();
    QStringList m_headList;
    QList<pRowData> m_tableList;
};


#endif // QMLTABLEVIEW_H




//Q_INVOKABLE virtual int rowCount(const QModelIndex &parent = QModelIndex()) const = 0;
//Q_INVOKABLE virtual int columnCount(const QModelIndex &parent = QModelIndex()) const = 0;
//Q_INVOKABLE virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const = 0;
//Q_INVOKABLE virtual QVariant headerData(int section, Qt::Orientation orientation,int role = Qt::DisplayRole) const;



//Q_INVOKABLE virtual QModelIndex index(int row, int column,const QModelIndex &parent = QModelIndex()) const = 0;
//Q_INVOKABLE virtual QModelIndex parent(const QModelIndex &child) const = 0;
//Q_INVOKABLE virtual bool hasChildren(const QModelIndex &parent = QModelIndex()) const;

